package com.ruiysoft.website.service;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.ruiysoft.website.dto.CmsContentEx;
import com.ruiysoft.website.entity.CmsCatalog;
import com.ruiysoft.website.entity.CmsContent;
import com.ruiysoft.website.entity.CmsContentDetail;
import com.ruiysoft.website.mapper.CmsCatalogMapper;
import com.ruiysoft.website.mapper.CmsContentDetailMapper;
import com.ruiysoft.website.mapper.CmsContentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by liudh on 2019/4/25.
 */

@Service
public class CmsCatalogService {
    @Autowired
    CmsCatalogMapper cmsCatalogMapper;

    public List<CmsCatalog> selectList(Integer enterpriseId, String parentCode) {
        EntityWrapper<CmsCatalog> ew = new EntityWrapper();
//        List columns = new ArrayList();
//        columns.add("createTime");
//        columns.add("sequence");

        ew.eq("enterpriseId", enterpriseId);
        if(parentCode != null && !parentCode.equals("null") && !parentCode.equals(""))
            ew.eq("parentCode", parentCode);

//        ew.orderDesc(columns);

        return cmsCatalogMapper.selectList(ew);
    }
}
